home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6726 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  25 lines

  1. Newsgroups: comp.lang.tcl,comp.lang.c,comp.lang.c++,comp.databases.sybase,comp.databases.oracle,comp.databases.informix,comp.databases.oracle
  2. Path: news.luc.edu!uchinews!news
  3. From: Charles Fiterman <cef@geodesic.com>
  4. Subject: Re: realloc equivalent in C++
  5. X-Nntp-Posting-Host: ford.uchicago.edu
  6. Message-ID: <DMo0t0.J1z@midway.uchicago.edu>
  7. Sender: news@midway.uchicago.edu (News Administrator)
  8. Organization: Geodesic Systems
  9. References: <4fecgc$ar9@engr.orst.edu> <DMJ15v.13C@falcon.daytonoh.attgis.com> <4fgir1$pri@theory.tc.cornell.edu>
  10. Date: Mon, 12 Feb 1996 13:43:48 GMT
  11.  
  12. In article <4fgir1$pri@theory.tc.cornell.edu>,
  13. Honbo Zhou <hzhou@r26n05.tc.cornell.edu> wrote:
  14. >Is there anything in C++ equvalent to realloc in C which can be used
  15. >to increase allocated memory? Can't find this even in C++ books which
  16. >talk about memory management specifically. Thanks. Honbo 
  17.  
  18. Realloc is one of C's mistakes. It assimes that the realloc()ed memory
  19. can be moved bitwise. In C++ this is often false. C++ objects often
  20. contain self pointers or are the targets of numerous outside pointers.
  21. So you need a realloc for each object type that invokes destructors
  22. and constructors to move things. It might be doable with templates.
  23.  
  24.  
  25.